package com.youaishujuhui.devops.web.controller.game;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.youaishujuhui.devops.web.domain.game.Company;
import com.youaishujuhui.devops.web.service.game.CompanyService;
import com.youaishujuhui.devops.web.vo.Result;

@Controller
@RequestMapping("/game/company")
public class CompanyController {
	
	@Autowired
    private CompanyService companyService;
	
    @RequestMapping("/page")
    public ModelAndView page(){
        return new ModelAndView("game/company");
    }

    @RequestMapping("/query")
    @ResponseBody
    public Result<List<Company>> query(){
        Result<List<Company>> result = new Result<>();

        List<Company> list = companyService.query();

        result.setData(list);
        result.setCode(Result.SUCCESS);

        return result;
    }
}
